
#include <stdio.h>
#include "Object.h"

class Test1 : public Object
{
public:
    virtual void foo() {
        x = 2;
        printf("foo: %d\n", x);
    }
    int x;
};

class Test2 : public Object
{
public:
    virtual void foo() {
        printf("T2:\n");
    }
};

REGISTER_CLASS_CREATOR(Test1);
REGISTER_CLASS_CREATOR(Test2);

int main()
{
    Test1* t1 = (Test1*)ObjectFactory::createByClassName("Test1");
    t1->foo();
    delete t1;
    Test2* t2 = (Test2*)ObjectFactory::createByClassName("Test2");
    t2->foo();
    delete t2;

    return 0;
}


